package action;

import java.io.IOException;
import java.util.List;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import Dao.TablesDao;

import entity.Tables;
import factory.DaoFactory;

public class FreeTableQuery extends HttpServlet{
	
	
	private static final long serialVersionUID = 1L;

	public void doPost(HttpServletRequest request, HttpServletResponse response)
				throws ServletException, IOException {
		this.doGet(request, response);

	}
	
	public void doGet(HttpServletRequest req, HttpServletResponse resp)
				throws ServletException, IOException {
		
		
		
		TablesDao td = DaoFactory.getTablesDao();
		
		
		List<Tables>  list = null;
		try {
			list = td.restList();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
//		req.setAttribute("List", list);
		req.setAttribute("List", list);
		RequestDispatcher rds = req.getRequestDispatcher("../freeTableQuery.jsp");
		rds.forward(req, resp);	
		
	}

}
